﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Slide.ascx.cs" Inherits="UserControls_Slide" %>
<%@ Import Namespace="BLL" %>
<script runat="server">
    SlideShowBLL dataSlide = new SlideShowBLL();
    ArticleBLL dataArticle = new ArticleBLL();
    </script>

                    <div class="gallery">
						<div id="slider" class="nivoSlider">
                        <%
                            var listImage = dataSlide.GetAll(6);
                            foreach (var item in listImage)
                            {
                                string name = item.Name;
                                string image = item.Image;
                                %>
                                <img src="/Images/SlideShow/<%=image %>" alt="<%=name %>" />
                                <%
                            }
                             %>
						</div>
					</div><!--End .gallery-->
					<div class="newsItem">
					<h1>Tin tức mới nhất</h1>
						<ul>
                            <%
                                var listNews = dataArticle.GetByCateParentId(13, true, 3);
                                if (listNews.Count >= 1)
                                {
                                    foreach (var item in listNews)
                                    {
                                        string title = Myfunction.SubString(item.Title, 5, "...");
                                        string des = Myfunction.SubString(item.Description, 23, "...");
                                        string image = item.Image;
                                        string url = "Change.aspx?Id=" + item.Id;
                                        %>
                                        <li>
								            <div class="post">
									            <a href="/<%=url %>"><img src="/Images/Article/<%=image %>" alt="<%=item.Title %>" title="<%=item.Title %>" /></a>
									            <a href="/<%=url %>"><h3><%=title %></h3></a>
									            <p><%=des %></p>
								            </div> 
							            </li>
                                        <%
                                    }
                                }
                                else
                                { 
                                    %>
                                    <p style="padding: 10px; color: Red; font-size: 1.2em;">Đang cập nhật...</p>
                                    <%
                                }
                                 %>
						</ul>
					</div><!--End .newsItem-->
